<?php error_reporting(E_ALL ^ E_NOTICE);ob_start();session_cache_expire(999999999);
if (!isset($_SESSION)) {
    session_start();
}
?>

<input id="id_shop" type="hidden" value="<?=$_REQUEST['id_shop']?>" />
<div onscroll="scroll();" onmouseenter="checkscroll();" id="scroll" class="scroll" style="overflow:scroll;height: 250px;">

<?php
	$list_product=$_SESSION['product_next'];
	$id=$_REQUEST['id_shop'];
	$result=$_REQUEST['result'];
	include "connection_open.php";
	for($j=0;$j<count($list_product);$j++)
		{
			if($list_product[$j][1]==$_REQUEST['id'])
			{
				$_SESSION['next']=$list_product[$j+1][1];
			}
		}
	if($result==0){
		$query=mysql_query("select * from product where id_shop=$id and (price_result=0 or price_result=3 or price_result=4 or price_result=5) AND `status`=1 and quantity=1 order by name ASC");
	}
	else if($result==1){
		$query=mysql_query("select * from product where id_shop=$id and (price_result=1 or price=price_new) and `status`=1 and quantity=1 order by name ASC");
		//echo "select * from product where id_shop=$id and price_result=1 AND price=price_new and `status`=1 and quantity=1 order by name ASC";
	}
	else if($result==2){
		$query=mysql_query("select * from product where id_shop=$id and price_result=2 AND price!=price_new and `status`=1 and quantity=1 order by name ASC");
		//echo "select * from product where id_shop=$id and price_result=2 AND price!=price_new and `status`=1 and quantity=1 order by name ASC";
	}else{
		$query=mysql_query("select * from product where id_shop=$id and price_result=$result AND `status`=1 and quantity=1 order by name ASC");
	}
	$i=1;
	while($row=@mysql_fetch_array($query))
	{		
/* 		if(($row['id']==$id || $row['price_new']==$row['price']) && $result!=1){
?>		
			<a href="javascript:void(0);" id="<?=$id?>" style="background-color:red;color:white" class="linkshop"  onclick="showurl('<?=$row['id']?>');showprice('<?=$row['id']?>')"><?=$i;?>.&nbsp;<?=$row['name'];?></a>
<?php
		
		}else{ */
	
?>
			<a href="javascript:void(0);" class="linkshop <?php if($row['id']==$_SESSION['next'])echo "selected"; else echo ""; ?>" style="padding:10px"  onclick="showurl('<?=$row['id']?>');showprice('<?=$row['id']?>')"><?=$i;?>.&nbsp;<?=$row['name'];?></a>
<?php		
			
	
	$i++;
	}	

	include "connection_close.php";
?>	
</div>